<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>用户管理-WeAdmin Frame型后台管理系统-WeAdmin 1.0</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, pass-scalable=0">
		<link rel="stylesheet" href="../../static/css/font.css">
		<link rel="stylesheet" href="../../static/css/weadmin.css">
		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
	      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
	      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
	    <![endif]-->
	</head>

	<body>
		<div class="weadmin-body">
			<form id="pass_form" action="" method="post" class="layui-form layui-form-pane">
				<div class="layui-form-item">
					<label for="note" class="layui-form-label">
                        <span class="we-red">*</span>描述
                    </label>
					<div class="layui-input-inline">
						<input type="text" id="note" name="note" required="" lay-verify="required" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item" id="pass_password_div">
					<label for="url" class="layui-form-label">
                        <span class="we-red">*</span>URL
                    </label>
					<div class="layui-input-inline">
						<input type="text" id="url" name="url" required="" lay-verify="required" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<button class="layui-btn" lay-submit="" lay-filter="add">提交</button>
				</div>
			</form>
		</div>
		<script src="../../lib/layui/layui.js" charset="utf-8"></script>
		<!--<script src="../../static/js/admin.js" charset="utf-8"></script>-->
		<script src="../../publicjs/jquery-1.8.0.min.js" charset="utf-8"></script>
		<script src="../../publicjs/smallkingutil.js" charset="utf-8"></script>
		<script type="text/javascript">
			layui.use(['form', 'layer'], function() {
				var form = layui.form,
					layer = layui.layer;
				// 监听表单提交
				form.on('submit(add)', function(data) {
					console.info(data);
					// var data = data.field;
					data = data.field;
					// 提交之前先遍历所勾选的资源
					var url = commonUtil.domain() + "/admin/right/pass/insert";
					var msg = "新增";
					var ajaxParam = {
						url: url,
						data: data
					}
					// 发送ajax 提交表单数据
					ajaxUtil.post(ajaxParam, function(data) {
						if(data.code == 200) {
							layer.alert(msg + "成功", {
								icon: 6
							}, function() {
								// 刷新父级的用户表格
								var parentHtml = window.parent;
								parentHtml.passTable.refresh();
								//关闭当前frame
								var index = parent.layer.getFrameIndex(window.name);
								parent.layer.close(index);
							});
						} else {
							layer.alert(data.msg);
						}
					});
					return false;
				});

			});
		</script>
		<script type="text/javascript">
			$(function() {
				commonUtil.setMaxLength(40);
			})
		</script>
	</body>

</html>